package com.yunji.cabinet.device;

import com.yunji.common.exception.device.DeviceErrorEnum;
import com.yunji.common.exception.device.DeviceException;
import com.yunji.common.utils.StringUtils;

/**
 * @author : peter-zhu
 * @date : 2025/1/15 09:46
 * @description : TODO
 **/
public class DeviceValidate {

    public static void bindNonNull(Object obj) {
        if (obj == null)
            throw new DeviceException(DeviceErrorEnum.CHECKED_212501);
    }

    public static void imeiNotEmpty(String imei) {
        if (StringUtils.isBlank(imei))
            throw new DeviceException(DeviceErrorEnum.CHECKED_212502, imei);
    }

    public static void snNotEmpty(String sn) {
        if (StringUtils.isBlank(sn))
            throw new DeviceException(DeviceErrorEnum.CHECKED_212505, sn);
    }


    public static void isBind(Integer status, String imei) {
        if (status == 1)
            throw new DeviceException(DeviceErrorEnum.CHECKED_212506, imei);
    }
}
